package com.changgou.listener;

import com.changgou.config.RabbitMQConfig;
import com.changgou.service.ESManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ProjectName: changgou_parent
 * @Package: com.changgou.listener
 * @ClassName: GoodsUpListener
 * @Author: 孙明田
 * @Description: 商品上架监听类
 * @Date: 2020/6/19 18:48
 * @Version: 1.0
 */

@Component
public class GoodsDownListener {

    @Autowired
    private ESManagerService esManagerService;

    //商品下架监听
    @RabbitListener(queues = RabbitMQConfig.GOODS_DOWN_QUEUE)
    public void receiveManage2(String spuId) {
        System.out.println("接收到的spuId:" + spuId);

        //根据spuId查询skuList列表,并导入到es中
        esManagerService.deleteDataBySpuId(spuId);
    }
}
